import type { PageList, ResponseStruct } from '#/global'

export interface CourseSectionVo {
  name?: string;
  id?:number;
  parent_id?:number;
  course_id?:number;
}

export interface CourseSectionSearchVo {
  name?: string
}

export function page(data: CourseSectionSearchVo): Promise<ResponseStruct<PageList<CourseSectionVo>>> {
  return useHttp().get('/admin/course-section', { params: data })
}

export function create(data: CourseSectionVo): Promise<ResponseStruct<null>> {
  return useHttp().post('/admin/course-section', data)
}

export function save(id: number, data: CourseSectionVo): Promise<ResponseStruct<null>> {
  return useHttp().put(`/admin/course-section/${id}`, data)
}

export function deleteByIds(ids: number[]): Promise<ResponseStruct<null>> {
  return useHttp().delete('/admin/course-section', { data: ids })
}

export function all(params = {}): Promise<ResponseStruct<CourseSectionVo[]>> {
  return useHttp().get('/admin/course-section/all', { params })
}
